IR sensor
Specification
NodeMCU
Pin Configuration
int IR = D1; void setup() { pinMode(IR,OUTPUT); // IR SENSOR AS INPUT DEVICE Serial.begin(9600); } void loop() { if(digitalRead(IR) == LOW){ Serial.println("Object Detected"); } else{ Serial.println("Object Not Detected"); delay(250); // Delay to Avoid the fast print } }